package sparksql

import org.apache.spark.sql.SparkSession

/**
  * spark-submit --class sparksql.SparkSessionApp --master local[2] /home/data/sparksql-1.0-SNAPSHOT.jar file:///opt/spark-2.3.2-bin-hadoop2.6/examples/src/main/resources/people.json
  */

object SparkSessionApp {
  def main(args: Array[String]): Unit = {
    val path = args(0);
    // val spark = SparkSession.builder().appName("SparkSessionApp").master("local[2]").getOrCreate();
    val spark = SparkSession.builder().getOrCreate();
    val person = spark.read.json(path);
    person.printSchema();
    person.show();
    spark.stop();
  }
}
